﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace Ue.Qcdz.Domain.Membership
{
    public static class UserProfileService
    {
        private static IDictionary<Guid, UserProfile> _userProfileCache;
        static UserProfileService()
        {
            UserProfileService._userProfileCache = new Dictionary<Guid, UserProfile>();
        }
        public static UserProfile GetUserProfile(Guid userId)
        {
            return UserProfileService._userProfileCache.Keys.Contains(userId)
                       ? UserProfileService._userProfileCache[userId]
                       : null;
        }
        public static ReadOnlyCollection<UserProfile> GetUserProfile()
        {
            return new ReadOnlyCollection<UserProfile>(UserProfileService._userProfileCache.Values.ToList());
        }
        public static void Add(UserProfile userProfile)
        {
            if (userProfile == null)
            {
                throw new ArgumentNullException("userProfile");
            }
            //UserProfileService._userProfileCache.Add(userProfile.Key,userProfile);
        }
        public static void Update(UserProfile userProfile)
        {
            //UserProfileService._userProfileCache[userProfile.Key] = userProfile;
        }
    }
}
